﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using QuanLyDuocPham.Controllers.QuanLyHeThong.DanhMuc;

namespace QuanLyDuocPham.View.QuanLyHeThong.DanhMuc
{
    /// <summary>
    /// Interaction logic for VATTU_Edit_View.xaml
    /// </summary>
    public partial class VATTU_Edit_View : Window
    {
        public VATTU_Edit_View()
        {
            InitializeComponent();
        }
        public delegate void added();
        public added done;

        string ma_dp;


        public string _ma_dp
        {
            set
            {
                ma_dp = value;
            }
        }
        private void btBack_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
        DUOCPHAM_Control dpctrl = new DUOCPHAM_Control();
        GIA_Control giactrl = new GIA_Control();
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            
            dpctrl.loadForm_Edit(ma_dp, cmbDVT, cmbNhom_VT, cmbThue, cmbNSX, cmbNCC, txtTen_Biet_Duoc, txtTon_NN, txtTon_LN, txtPhan_Loai, chbDoc_Duoc, txtHDSD, txtHanDung,  txtDong_Goi, txtNong_Do, txtSDK, txtNhietDo_BaoQuan, chbASMT, chbAm, chbDong, chbNong, txtCong_Dung, txtGhi_Chu, txtTem);
            giactrl.loadForm_Edit(ma_dp, txtGia_Si, txtGia_Le);
        }

        private void btOk_Click(object sender, RoutedEventArgs e)
        {
            dpctrl.updateData(ma_dp, cmbDVT, cmbNhom_VT, cmbThue, cmbNSX, cmbNCC, txtTen_Biet_Duoc, txtTon_NN, txtTon_LN, txtPhan_Loai, chbDoc_Duoc, txtHDSD, txtHanDung,  txtDong_Goi, txtNong_Do, txtSDK, txtNhietDo_BaoQuan, chbASMT, chbAm, chbDong, chbNong, txtCong_Dung, txtGhi_Chu, txtTem);

            if (done != null)
            {
                done();
            }
            giactrl.addData(ma_dp, txtGia_Si, txtGia_Le);
        }
    }
}
